package com.luge.composedemo

import android.app.Activity
import android.content.Intent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.semantics.Role.Companion.Image
import androidx.compose.ui.unit.dp

private lateinit var mAc:Activity

@Composable
fun WelcomePage(act:Activity){
    mAc = act

    Box(modifier = Modifier
        .fillMaxSize()
        .background(MaterialTheme.colorScheme.background), contentAlignment = Alignment.BottomCenter){
//        Image(
//            painter = rememberVectorPainter(image = )
//        )
//        Text(
//
//        )

    }

    WelcomeContent()


}

@Composable
fun WelcomeContent() {
    Column {
        Spacer(modifier = Modifier.height(71.dp))
        //
        TextButton(onClick = { goActivity(mAc) }) {
            Text(text ="login")
        }
    }
}


//路由分发
fun goActivity(act:Activity){
    val intent = Intent(act,LoginActivtiy::class.java)
    act.startActivity(intent)
}